/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sorUtils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Formatter;

/**
 *
 * @author eltorre
 */
public class CipherSha1 {
   
    public static String EncriptarSHA1 (byte[] s) throws NoSuchAlgorithmException
    {
        MessageDigest md = MessageDigest.getInstance("SHA-1");
        byte [] bytes = md.digest(s);
        Formatter formatter = new Formatter();
        
        StringBuilder hexString = new StringBuilder();
        for (int i=0;i<bytes.length;i++) {
            formatter.format("%02x", bytes[i]);
        }
        
        return formatter.toString();
    }
     
}
